<!DOCTYPE html>
<html lang="en">
<!-- 维修员个人信息管理页面 -->
<?php
// 判断是否正常访问
session_start();
if (!isset($_SESSION['REPAIRER'])) {
    echo "<script>alert('非法访问！请先登录！');window.location.href='../../../index.html';</script>";
    die();
}
?>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>校园报修系统 · 维修员</title>
    <link rel="stylesheet" href="../bootstrap-5.3.3-dist/bootstrap.min.css">
    <script src="../bootstrap-5.3.3-dist/bootstrap.min.js"></script>
    <link rel="stylesheet" href="css/r-public.css">
    <link rel="stylesheet" href="css/r-info.css">
    <script src="js/r-info.js"></script>
</head>

<body>
    <nav class="navbar fixed-top navbar-expand-lg bg-body-tertiary navbar-style">
        <div class="container-fluid">
            <a class="navbar-brand" href="javascript:;">校园报修系统</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarText"
                aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarText">
                <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                    <li class="nav-item">
                        <a class="nav-link" href="r-main.php">待维修任务</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="r-history.php">历史维修任务</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link active" aria-current="page" href="r-info.php">我的信息</a>
                    </li>
                </ul>
                <span class="navbar-text">
                    当前登录：<?php echo $_SESSION['REPAIRER']['r_name'];?>
                </span>
                <span class="navbar-text logout-btn">
                    <a href="php/logout.php">
                        <button class="btn btn-danger">退出登录</button>
                    </a>
                </span>
            </div>
        </div>
    </nav>
    <main>
        <div class="content">
            <h4>我的信息管理</h4>
            <div class="basicinfo-div">
                <p class="basicinfo-title">基本信息管理</p>
                <div>
                    <form class="row g-3" action="php/deal.php" method="get">
                        <input type="hidden" name="action" value="update_info">
                        <div class="col-md-6">
                            <label for="r_id" class="form-label">工号ID（不可更改）</label>
                            <input type="text" class="form-control" id="r_id" name="r_id" value="<?php echo $_SESSION['REPAIRER']['r_id']?>" readonly>
                        </div>
                        <div class="col-md-4">
                            <label for="r_name" class="form-label">姓名</label>
                            <input type="text" class="form-control" id="r_name" name="r_name" value="<?php echo $_SESSION['REPAIRER']['r_name'];?>" onchange="check_name();" required>
                        </div>
                        <div class="col-md-2">
                            <label for="r_sex" class="form-label">性别（不可更改）</label>
                            <input type="text" class="form-control" id="r_sex" name="r_sex" value="<?php echo $_SESSION['REPAIRER']['r_sex'];?>" readonly>
                        </div>
                        <div class="col-md-6">
                            <label for="r_phone" class="form-label">手机号码</label>
                            <input type="text" class="form-control" id="r_phone" name="r_phone" value="<?php echo $_SESSION['REPAIRER']['r_phone'];?>" onchange="check_phone();" required>
                        </div>
                        <div class="col-12 sub-btn">
                            <button class="btn btn-primary" type="submit" id="subbtn" disabled>提交修改信息</button>
                        </div>
                    </form>
                </div>
            </div>
            <div class="basicinfo-div">
                <p class="basicinfo-title">登录密码修改</p>
                <form class="row g-3" action="php/deal.php" method="get">
                    <input type="hidden" name="r_id" value="<?php echo $_SESSION['REPAIRER']['r_id']?>">
                    <input type="hidden" name="action" value="update_pwd">
                    <div class="col-md-7">
                        <label for="r_old_pwd" class="form-label">请输入原始密码</label>
                        <input type="password" class="form-control" id="r_old_pwd" name="r_old_pwd" required>
                    </div>
                    <div class="col-md-7">
                        <label for="r_new_pwd" class="form-label">请输入新的密码</label>
                        <input type="password" class="form-control" id="r_new_pwd" name="r_new_pwd" required>
                    </div>
                    <div class="col-md-7">
                        <label for="ren_new_pwd" class="form-label">确认新的密码</label>
                        <input type="password" class="form-control" id="ren_new_pwd" required>
                    </div>
                    <div class="col-12 sub-btn">
                        <button class="btn btn-primary" type="submit" onclick="return check_pwd();">提交修改密码</button>
                    </div>
                </form>
            </div>
        </div>
    </main>
    <footer>
        校园报修系统 · 维修员 © 2025 All rights reserved.
    </footer>
</body>

</html>